package com.heima.user.controller;

import com.heima.model.behavior.dtos.IsFollowDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.UserFollowDto;
import com.heima.user.service.UserFollowService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@Slf4j
@RestController
@RequestMapping("/api/v1/user/user_follow")
public class UserFollowController {

    private final UserFollowService userFollowService;

    @PostMapping
    public ResponseResult follow(@RequestBody UserFollowDto userFollowDto) {
        log.info("传入userFollowDto {}", userFollowDto);
        userFollowService.follow(userFollowDto);
        return ResponseResult.okResult(null);
    }

    @PostMapping("/isFollow")
    public Boolean isFollow(@RequestBody IsFollowDto isFollowDto) {
        return userFollowService.isFollow(isFollowDto);
    }
}
